<template>
    <div class="flex_col card2 p10 m5">
        <label class="flex_center_self">电机调试</label>
        <div class="flex_row_center mt5">
            <label>上层电机:</label>
            <el-button @click="motorCtrl(1, 1)" type="primary">顺时针</el-button>
            <el-button @click="motorCtrl(1, 2)" type="primary">逆时针</el-button>
            <el-button @click="motorCtrl(1, 0)" type="warning">停止</el-button>
        </div>
        <div class="flex_row_center mt5">
            <label>下层电机:</label>
            <el-button @click="motorCtrl(2, 1)" type="primary">顺时针</el-button>
            <el-button @click="motorCtrl(2, 2)" type="primary">逆时针</el-button>
            <el-button @click="motorCtrl(2, 0)" type="warning">停止</el-button>
        </div>
    </div>
</template>

<script lang="ts" setup>
import { service } from '../service/service';
import { runAction } from '../utils/ui';


async function motorCtrl(id: number, dir: number) {
    runAction('电机控制', '执行中', async () => {
        await service.motorCtrl(id, dir);
    }) 
}



</script>
